<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/socket/internal/IocpService.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_9ad1227260954e346101f3844f0abb3d.html">socket</a></li><li class="navelem"><a class="el" href="dir_1865c4ce8b99f52bbeabfd52bfdd7cd3.html">internal</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">IocpService.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_iocp_service_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*****************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">*  @file     TcpIocpServer.h                                                 *</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">*  @brief    tcp iocp操作类                                                  *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">*  @author   weiqi.li                                                        *</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">*  @email    wcmxiaolizi@foxmail.com                                         *</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">*  @remarks  仅dll内部使用的文件                                             *</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">*  @version  1.0.0.0                                                         *</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">*****************************************************************************/</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160; </div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef __SOCKETSERVER_H__</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#define __SOCKETSERVER_H__</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &quot;../../tools/tools.h&quot;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#ifdef WIN32</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_io_port_service_8h.html">IoPortService.h</a>&quot;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;../../thread/Thread.h&quot;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// 不推荐在多个线程中对同一个套接字进行操作，极其容易出现问题</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">class </span><a class="code" href="tools_8h.html#a64152c8b939d1ce06c7c5cb6c97b62f8">LIBTOOLS</a> CIocpService:<span class="keyword">public</span> <a class="code" href="class_c_io_port_service.html">CIoPortService</a></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;{</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <span class="comment">// 构造一个tcp service类，并设置上层调用完成函数</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    CIocpService(<a class="code" href="_sock_data_8h.html#ae8573b45542da05c99e8e2154032d606">IoCompleteFunc</a> func);</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    <span class="comment">// 重载构造函数会调用 Init函数,若Init失败则会抛出异常(CSockException)</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    CIocpService(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock, <a class="code" href="_sock_data_8h.html#ae8573b45542da05c99e8e2154032d606">IoCompleteFunc</a> func);</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keyword">virtual</span> ~CIocpService();</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    </div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="comment">// 用于初始化IOCP等</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <a class="code" href="class_c_sock_error.html">CSockError</a> <a class="code" href="class_c_io_port_service.html#afc1a07c4cf6e9aa6f2a00d157dfd9eed">Init</a>();</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="keyword">virtual</span> <a class="code" href="class_c_sock_error.html">CSockError</a> <a class="code" href="class_c_io_port_service.html#afc1a07c4cf6e9aa6f2a00d157dfd9eed">Init</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock, <span class="keywordtype">bool</span> isServer = <span class="keyword">false</span>);</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#aa9c6a13fde3ceae6b494568242681714">PostAcceptEx</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; svrSock, <a class="code" href="class_c_socket.html">CSocket</a>&amp; cliSock, <span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker = <a class="code" href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a>);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#af9546027933d2fcfcdc31b9366308ec3">PostConnectEx</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock, <span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker = NULL);</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#a5ffa1d9379ae7595d2febd119f42a738">SetTimer</a>(<a class="code" href="_timer_info_8h.html#a3cdb46a4463fd5c4c305382491ab3e41">TimerInfo</a>&amp; tinfo);</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#a6a56a2a5a014ee11d4696eac5096d198">DelTimer</a>(<a class="code" href="_timer_info_8h.html#a3cdb46a4463fd5c4c305382491ab3e41">TimerInfo</a>&amp; tinfo);</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160; </div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_io_port_service.html#ac30315805f5476c9e5ff36f3fa542485">UpdateTimer</a>(<a class="code" href="_timer_info_8h.html#a3cdb46a4463fd5c4c305382491ab3e41">TimerInfo</a>&amp; tinfo);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#a61ce383d1dc8faf0f821237e4cc438cf">DeliveryWrite</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock, <span class="keyword">const</span> <span class="keywordtype">char</span>* first, <span class="keyword">const</span> <span class="keywordtype">char</span>* end, <a class="code" href="class_c_sock_addr.html">CSockAddr</a>* addr, <span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker = NULL);</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#a258367c891c1b3f4208c7b41e95b864d">DeliveryRecv</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock, <span class="keywordtype">char</span>* first, <span class="keywordtype">char</span>* end, <a class="code" href="class_c_sock_addr.html">CSockAddr</a>* addr, <span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker = <a class="code" href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a>);</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160; </div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="comment">/* 提供一个异步完成的关闭操作，当操作完成时会通知上层回调</span></div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="comment">     * @return 成功返回0，失败返回其它值</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="comment">     * 多线程下仍然存在问题，不推荐使用该设计方式</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="comment">    */</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="comment">//virtual CSockError AsyncClose(CSocket&amp; sock, CStreamSocketBuffer&amp; buff, IoCompleteFunc func, void* invoker);</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160; </div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#a2b82286514aa89ecd2a7470047c4845e">Post</a>(<span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;HandleBase&gt;</a>&amp; func, <span class="keywordtype">void</span>* invoker = <a class="code" href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a>);</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    </div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_io_port_service.html#a87b609526def283ffb20cc4b4c082473">IsStop</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">IsInit</a>() <span class="keyword">const</span>;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_io_port_service.html#a56a9ae4bb89bd85e21ae5507e3c6b093">Run</a>();</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_c_io_port_service.html#a8eb92d255bda145631e1dc57e42d3dba">Run_One</a>();</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_c_io_port_service.html#a88ce9281be3952a469f8c3b6bf0f9d5b">NotifyStop</a>();</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160; </div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_c_io_port_service.html#a3de4a75423e43c4100831feee1c67406">Close</a>(<a class="code" href="class_c_socket.html">CSocket</a>&amp; sock);</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleRead(<a class="code" href="struct_socket_data.html">SocketData</a>* sockdata, <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer, <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> dwRecvice);</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160; </div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleWrite(<a class="code" href="struct_socket_data.html">SocketData</a>* sockdata, <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer, <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> dwWrite);</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160; </div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleIocp(<a class="code" href="struct_socket_data.html">SocketData</a>* sockdata, <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer, <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> lastStatus, <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> dealSize = 0);</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160; </div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleAccept( <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer);</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleConnect(<a class="code" href="struct_socket_data.html">SocketData</a>* sockdata, <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer);</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    <span class="comment">//DWORD HandlePost(OVERLAPPED_EX* buffer);</span></div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleTimeout();</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> HandleComplete(<a class="code" href="class_s_list.html">SList</a>&lt;<a class="code" href="class_shared_ptr.html">SharedPtr&lt;OVERLAPPED_EX&gt;</a> &gt;&amp; os);</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160; </div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> __TimeoutThread();</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    <span class="keyword">static</span> <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> TimeoutThread(<span class="keywordtype">void</span>* invoker);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160; </div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    <span class="comment">// 更新套接字的超时时间</span></div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    <span class="comment">//void UpdateTime(TimeoutInfo&amp; tinfo, UpdateAction ua);</span></div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160; </div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_c_io_port_service.html#ae247b9ad53c577481a6a17713e6a0685">Shutdown</a>();</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160; </div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> DealIoBuffer(<a class="code" href="struct_socket_data.html">SocketData</a>* sockData, <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer, <a class="code" href="socket_2internal_2_macro_tools_8h.html#a6a02b2d1d62293b20242e3dcfbdd0117">OperatorType</a> op, <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> status, <span class="keyword">const</span> <span class="keywordtype">char</span>* headmsg);</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> DealIoBuffer(<a class="code" href="class_s_list.html">SList</a>&lt;<a class="code" href="class_shared_ptr.html">SharedPtr&lt;OVERLAPPED_EX&gt;</a> &gt;&amp; iolist, <a class="code" href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a>* buffer, <a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> status, <span class="keyword">const</span> <span class="keywordtype">char</span>* headmsg);</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    <a class="code" href="tools_8h.html#ab521aa5010fb1afb801a899a55569e03">HANDLE</a> _hCompletionPort;                            <span class="comment">// 完成端口句柄</span></div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <a class="code" href="class_c_thread.html">CThread</a> _threadTimeout;                             <span class="comment">// 超时线程</span></div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <a class="code" href="tools_8h.html#ab521aa5010fb1afb801a899a55569e03">HANDLE</a> _hTimer;                                     <span class="comment">// 定时器句柄</span></div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;};</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160; </div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160; </div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;<span class="preprocessor">#endif // WIN32</span></div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160; </div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclass_s_list_html"><div class="ttname"><a href="class_s_list.html">SList</a></div><div class="ttdoc">单链表 只提供向前访问</div><div class="ttdef"><b>Definition:</b> <a href="_s_list_8h_source.html#l00286">SList.h:286</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a56a9ae4bb89bd85e21ae5507e3c6b093"><div class="ttname"><a href="class_c_io_port_service.html#a56a9ae4bb89bd85e21ae5507e3c6b093">CIoPortService::Run</a></div><div class="ttdeci">virtual bool Run()=0</div><div class="ttdoc">运行服务</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a61ce383d1dc8faf0f821237e4cc438cf"><div class="ttname"><a href="class_c_io_port_service.html#a61ce383d1dc8faf0f821237e4cc438cf">CIoPortService::DeliveryWrite</a></div><div class="ttdeci">virtual void DeliveryWrite(CSocket &amp;sock, const char *first, const char *end, CSockAddr *addr, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个写请求</div></div>
<div class="ttc" id="aclass_c_sock_error_html"><div class="ttname"><a href="class_c_sock_error.html">CSockError</a></div><div class="ttdoc">套接字错误信息类</div><div class="ttdef"><b>Definition:</b> <a href="_sock_error_8h_source.html#l00013">SockError.h:13</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a3de4a75423e43c4100831feee1c67406"><div class="ttname"><a href="class_c_io_port_service.html#a3de4a75423e43c4100831feee1c67406">CIoPortService::Close</a></div><div class="ttdeci">virtual int Close(CSocket &amp;sock)=0</div><div class="ttdoc">关闭描述符</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_af9546027933d2fcfcdc31b9366308ec3"><div class="ttname"><a href="class_c_io_port_service.html#af9546027933d2fcfcdc31b9366308ec3">CIoPortService::PostConnectEx</a></div><div class="ttdeci">virtual void PostConnectEx(CSocket &amp;sock, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个连接请求</div></div>
<div class="ttc" id="aclass_shared_ptr_html"><div class="ttname"><a href="class_shared_ptr.html">SharedPtr&lt; HandleBase &gt;</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a8eb92d255bda145631e1dc57e42d3dba"><div class="ttname"><a href="class_c_io_port_service.html#a8eb92d255bda145631e1dc57e42d3dba">CIoPortService::Run_One</a></div><div class="ttdeci">virtual bool Run_One()=0</div><div class="ttdoc">运行一次服务</div></div>
<div class="ttc" id="aclass_c_sock_addr_html"><div class="ttname"><a href="class_c_sock_addr.html">CSockAddr</a></div><div class="ttdoc">协议地址结构体</div><div class="ttdef"><b>Definition:</b> <a href="_sock_tools_8h_source.html#l00043">SockTools.h:43</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a6a56a2a5a014ee11d4696eac5096d198"><div class="ttname"><a href="class_c_io_port_service.html#a6a56a2a5a014ee11d4696eac5096d198">CIoPortService::DelTimer</a></div><div class="ttdeci">virtual void DelTimer(TimerInfo &amp;tinfo)=0</div><div class="ttdoc">删除定时器</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a258367c891c1b3f4208c7b41e95b864d"><div class="ttname"><a href="class_c_io_port_service.html#a258367c891c1b3f4208c7b41e95b864d">CIoPortService::DeliveryRecv</a></div><div class="ttdeci">virtual void DeliveryRecv(CSocket &amp;sock, char *first, char *end, CSockAddr *addr, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个接收请求</div></div>
<div class="ttc" id="atools_8h_html_a64152c8b939d1ce06c7c5cb6c97b62f8"><div class="ttname"><a href="tools_8h.html#a64152c8b939d1ce06c7c5cb6c97b62f8">LIBTOOLS</a></div><div class="ttdeci">#define LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00095">tools.h:95</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_ac30315805f5476c9e5ff36f3fa542485"><div class="ttname"><a href="class_c_io_port_service.html#ac30315805f5476c9e5ff36f3fa542485">CIoPortService::UpdateTimer</a></div><div class="ttdeci">virtual bool UpdateTimer(TimerInfo &amp;tinfo)=0</div><div class="ttdoc">更新定时器</div></div>
<div class="ttc" id="aclass_c_socket_html"><div class="ttname"><a href="class_c_socket.html">CSocket</a></div><div class="ttdoc">套接口类</div><div class="ttdef"><b>Definition:</b> <a href="_socket_8h_source.html#l00030">Socket.h:30</a></div></div>
<div class="ttc" id="a_sock_data_8h_html_ae8573b45542da05c99e8e2154032d606"><div class="ttname"><a href="_sock_data_8h.html#ae8573b45542da05c99e8e2154032d606">IoCompleteFunc</a></div><div class="ttdeci">DWORD(* IoCompleteFunc)(OVERLAPPED_EX *oved)</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00017">SockData.h:17</a></div></div>
<div class="ttc" id="a_io_port_service_8h_html"><div class="ttname"><a href="_io_port_service_8h.html">IoPortService.h</a></div></div>
<div class="ttc" id="aclass_c_thread_html"><div class="ttname"><a href="class_c_thread.html">CThread</a></div><div class="ttdoc">线程类</div><div class="ttdef"><b>Definition:</b> <a href="_thread_8h_source.html#l00027">Thread.h:27</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_aa9c6a13fde3ceae6b494568242681714"><div class="ttname"><a href="class_c_io_port_service.html#aa9c6a13fde3ceae6b494568242681714">CIoPortService::PostAcceptEx</a></div><div class="ttdeci">virtual void PostAcceptEx(CSocket &amp;svrSock, CSocket &amp;cliSock, const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个接收连接请求</div></div>
<div class="ttc" id="astruct_o_v_e_r_l_a_p_p_e_d___e_x_html"><div class="ttname"><a href="struct_o_v_e_r_l_a_p_p_e_d___e_x.html">OVERLAPPED_EX</a></div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00063">SockData.h:63</a></div></div>
<div class="ttc" id="astruct_socket_data_html"><div class="ttname"><a href="struct_socket_data.html">SocketData</a></div><div class="ttdoc">套接口数据</div><div class="ttdef"><b>Definition:</b> <a href="_sock_data_8h_source.html#l00029">SockData.h:29</a></div></div>
<div class="ttc" id="a_timer_info_8h_html_a3cdb46a4463fd5c4c305382491ab3e41"><div class="ttname"><a href="_timer_info_8h.html#a3cdb46a4463fd5c4c305382491ab3e41">TimerInfo</a></div><div class="ttdeci">class _TimerInfo_ TimerInfo</div></div>
<div class="ttc" id="atools_8h_html_ab521aa5010fb1afb801a899a55569e03"><div class="ttname"><a href="tools_8h.html#ab521aa5010fb1afb801a899a55569e03">HANDLE</a></div><div class="ttdeci">#define HANDLE</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00156">tools.h:156</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a5ffa1d9379ae7595d2febd119f42a738"><div class="ttname"><a href="class_c_io_port_service.html#a5ffa1d9379ae7595d2febd119f42a738">CIoPortService::SetTimer</a></div><div class="ttdeci">virtual void SetTimer(TimerInfo &amp;tinfo)=0</div><div class="ttdoc">设置定时器</div></div>
<div class="ttc" id="atools_8h_html_a798af1e30bc65f319c1a246cecf59e39"><div class="ttname"><a href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a></div><div class="ttdeci">unsigned int DWORD</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00134">tools.h:134</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html"><div class="ttname"><a href="class_c_io_port_service.html">CIoPortService</a></div><div class="ttdef"><b>Definition:</b> <a href="_io_port_service_8h_source.html#l00032">IoPortService.h:32</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a87b609526def283ffb20cc4b4c082473"><div class="ttname"><a href="class_c_io_port_service.html#a87b609526def283ffb20cc4b4c082473">CIoPortService::IsStop</a></div><div class="ttdeci">virtual bool IsStop() const =0</div><div class="ttdoc">服务是否停止</div></div>
<div class="ttc" id="atools_8h_html_ab689500aaec0db066e3ac9483d3fe425"><div class="ttname"><a href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a></div><div class="ttdeci">#define NullPtr</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00119">tools.h:119</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a4e27edba8096659e67f2f275eeeba984"><div class="ttname"><a href="class_c_io_port_service.html#a4e27edba8096659e67f2f275eeeba984">CIoPortService::IsInit</a></div><div class="ttdeci">virtual bool IsInit() const =0</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_afc1a07c4cf6e9aa6f2a00d157dfd9eed"><div class="ttname"><a href="class_c_io_port_service.html#afc1a07c4cf6e9aa6f2a00d157dfd9eed">CIoPortService::Init</a></div><div class="ttdeci">virtual CSockError Init(CSocket &amp;sock, bool isServer=false)=0</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a88ce9281be3952a469f8c3b6bf0f9d5b"><div class="ttname"><a href="class_c_io_port_service.html#a88ce9281be3952a469f8c3b6bf0f9d5b">CIoPortService::NotifyStop</a></div><div class="ttdeci">virtual void NotifyStop()=0</div><div class="ttdoc">通知停止服务</div></div>
<div class="ttc" id="aclass_c_io_port_service_html_a2b82286514aa89ecd2a7470047c4845e"><div class="ttname"><a href="class_c_io_port_service.html#a2b82286514aa89ecd2a7470047c4845e">CIoPortService::Post</a></div><div class="ttdeci">virtual void Post(const SharedPtr&lt; HandleBase &gt; &amp;func, void *invoker=NullPtr)=0</div><div class="ttdoc">投递一个中断请求</div></div>
<div class="ttc" id="asocket_2internal_2_macro_tools_8h_html_a6a02b2d1d62293b20242e3dcfbdd0117"><div class="ttname"><a href="socket_2internal_2_macro_tools_8h.html#a6a02b2d1d62293b20242e3dcfbdd0117">OperatorType</a></div><div class="ttdeci">OperatorType</div><div class="ttdef"><b>Definition:</b> <a href="socket_2internal_2_macro_tools_8h_source.html#l00016">MacroTools.h:16</a></div></div>
<div class="ttc" id="aclass_c_io_port_service_html_ae247b9ad53c577481a6a17713e6a0685"><div class="ttname"><a href="class_c_io_port_service.html#ae247b9ad53c577481a6a17713e6a0685">CIoPortService::Shutdown</a></div><div class="ttdeci">virtual int Shutdown()=0</div><div class="ttdoc">停止服务,该函数会等待所有的线程退出</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
